import Mock from 'mockjs'

const data = Mock.mock({
    code: '200',
    message: '继续注册',
    // data: [{
    //     'id|+1': 1,
    // }]
})

// 发送验证码
const img = Mock.mock({
    code: '200',
    message: '继续注册',
    "data|100000-999999": 1
})

// 注册
// const join = Mock.mock({
//     code: '200',
//     message: '注册成功',
//     data:[]
// })

export let list = [{
    tel: '18888888888',
    password: '123456'
}]


const join = Mock.mock(list)

Mock.mock('/docheckphone', 'post', (config) => {
    // console.log(JSON.parse(config.body))
    return data
})

// 发送验证码
Mock.mock('/dosendmsgcode', 'post', (config) => {
    // console.log(JSON.parse(config.body))
    return img
})

// 注册
// Mock.mock('/dofinishregister', 'post', (config) => {
//     // console.log(JSON.parse(config.body))
//     join.data.push(JSON.parse(config.body))
//     return join
// })

Mock.mock('/dofinishregister', 'post', (config) => {
    list.push(JSON.parse(config.body))
    console.log(list);
    return Mock.mock({
        "code": '200',
        "message": "注册成功",
    });
})